﻿/*
**  ContactID类
*/
if (!$.Engine.Collision || typeof $.Engine.Collision === "undefined") $.Engine.Collision = {};
$.Engine.Collision.ContactID = function () {
  this.features = new $.Engine.Collision.Features();
  this.features._m_id = this;
};

// We use contact ids to facilitate warm starting.
Object.extend($.Engine.Collision.ContactID.prototype, {
  Set: function (id) {
    this.set_key(id._key);
  },
  Copy: function () {
    var id = new $.Engine.Collision.ContactID();
    id.set_key(this._key);
    return id;
  },
  get_key: function () {
    return this._key;
  },
  set_key: function (value) {
    this._key = value;
    this.features._referenceFace = this._key & 0x000000ff;
    this.features._incidentEdge = ((this._key & 0x0000ff00) >> 8) & 0x000000ff;
    this.features._incidentVertex = ((this._key & 0x00ff0000) >> 16) & 0x000000ff;
    this.features._flip = ((this._key & 0xff000000) >> 24) & 0x000000ff;
  },
  features: new $.Engine.Collision.Features(),
  _key: 0
});